<?php
$startTime = microtime(TRUE);

$con = mysqli_connect("localhost","softbos","developer","Logins");
mysqli_set_charset($con, "utf8");
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$i=0;
while(isset($_POST['Id'.$i])){
	$Id = mysqli_real_escape_string($con, $_POST['Id'.$i] );
	$UserId = mysqli_real_escape_string($con, $_POST['UserId'.$i] );
	$CompanyId = mysqli_real_escape_string($con, $_POST['CompanyId'.$i] );
	$Salary = mysqli_real_escape_string($con, $_POST['Salary'.$i] );
	$Name = mysqli_real_escape_string($con, $_POST['Name'.$i] );
	$SecondName = mysqli_real_escape_string($con, $_POST['SecondName'.$i] );
	$sql = "INSERT INTO Customer (Id, UserId, CompanyId, Salary, Name, SecondName) VALUES ($Id,$UserId,$CompanyId,$Salary,'$Name','$SecondName')";
	
	if (!mysqli_query($con,$sql)) {
	  die('Error: ' . mysqli_error($con));
	}
	echo $sql.'<br/>';
	$i++;
}

mysqli_close($con);
echo "Processed $i INSERT query(ies) " .(microtime(TRUE) - $startTime)."sec <br/>";	
?> 
